package com.kl.example.serializer;

import com.kl.example.model.MessageModelExample;
import com.kl.example.util.ProtostuffUtil;
import org.apache.kafka.common.serialization.Serializer;

/**
 * 基于protostuff的序列化
 */
public class MyMessageProtostuffSerializer implements Serializer<MessageModelExample> {

    @Override
    public byte[] serialize(String topic, MessageModelExample data) {
        return ProtostuffUtil.serializer(data, MessageModelExample.class);
    }
}
